package org.pr.ddddesigner.infrastructure.exception;

import com.lion.commons.exception.ServiceExceptionDefinition;

/**
 * 业务异常枚举
 *
 * @author bufanqi
 * @date 2021-09-26 10:35
 **/
public enum ServiceExceptionEnum implements ServiceExceptionDefinition {
    // ========== 模型 ==========
    MODEL_NAME_NOT_NULL(1101001001, "模型名称不能为空"),
    MODEL_NOT_FOUND(1101001002, "模型未找到"),
    MODEL_FILE_NOT_FOUND(1101001003, "模型文件不存在"),
    MODEL_FILE_FOLDER_CREATE_FAIL(1101001004, "模型目录创建失败"),
    //------------升级--------------
    MODEL_VERSION_IS_TOO_LOW(1102002001, "版本必须大于当前版本"),
    //------------API---------------
    MODEL_FILE_API_FAIL(1103001001, "文件接口调用失败"),

    // by chenbin
    COMPONENT_TAG_EXISTS(1203001001, "标签已存在"),

    COMPONENT_PROPERTY_KEY_EXISTS(1204001001, "属性已存在"),
    ;
    /**
     * 错误码
     */
    private final int code;
    /**
     * 错误提示
     */
    private final String message;

    ServiceExceptionEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

}
